<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
  <title>Description of clf_knn_dist</title>
  <meta name="keywords" content="clf_knn_dist">
  <meta name="description" content="k-nearest neighbor classifier based on a distance matrix D.">
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <meta name="generator" content="m2html &copy; 2003 Guillaume Flandin">
  <meta name="robots" content="index, follow">
  <link type="text/css" rel="stylesheet" href="../m2html.css">
</head>
<body>
<a name="_top"></a>
<!-- menu.html classify -->
<h1>clf_knn_dist
</h1>

<h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>k-nearest neighbor classifier based on a distance matrix D.</strong></div>

<h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>function IDXpred = clf_knn_dist( D, IDX, k ) </strong></div>

<h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="fragment"><pre class="comment"> k-nearest neighbor classifier based on a distance matrix D.

 k==1 is much faster than k&gt;1.  For k&gt;1, ties are broken randomly.

 INPUTS
   D       - MxN array of distances from M-TEST points to N-TRAIN points.
   IDX     - ntrain length vector of class memberships 
             if IDX(i)==IDX(j) than sample i and j are part of the same class
   k       - [optional] number of nearest neighbors to use, 1 by default

 OUTPUTS
   IDXpred - length M vector of classes for training data

 EXAMPLE
   % [given D and IDX]
   for k=1:size(D,2) err(k)=sum(IDX==clf_knn_dist(D,IDX,k)); end; 
   figure(1); plot(err)

 DATESTAMP
   11-Oct-2005  8:00pm

 See also <a href="clf_knn.html" class="code" title="function clf = clf_knn( p, k, dist_fn )">CLF_KNN</a></pre></div>

<!-- crossreference -->
<h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
This function calls:
<ul style="list-style-image:url(../matlabicon.gif)">
</ul>
This function is called by:
<ul style="list-style-image:url(../matlabicon.gif)">
<li><a href="clf_knn_fwd.html" class="code" title="function Y = clf_knn_fwd( clf, X )">clf_knn_fwd</a>	Apply a k-nearest neighbor classifier to X.</li></ul>
<!-- crossreference -->



<hr><address>Generated on Wed 03-May-2006 23:48:50 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/" target="_parent">m2html</a></strong> &copy; 2003</address>
</body>
</html>